<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('主机时间同步状态信息列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            节点：
                            <select name="nodeCode" th:with="nodes=${@node.getCacheNodeInfoAll()}">
                                <option value="">所有</option>
                                <option th:each="node:${nodes}" th:title="${node.ip}" th:value="${node.nodeCode}"
                                        th:text="${node.hostname}"></option>
                            </select>
                        </li>
                        <li>
                            NTP服务器地址：<input type="text" name="ntpServerIp"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var ntpdateStatusDatas = [[${@dict.getType('time_sync_status')}]];
    var prefix = ctx + "system/nodeNtpdate";

    $(function () {
        queryList();
    });

    function queryList() {
        var options = {
            url: prefix + "/list",
            exportUrl: prefix + "/export",
            sortName: "nodeCode",
            modalName: "节点",
            columns: [{
                checkbox: true
            },
            {
                field: 'id',
                title: '编号',
                sortable: true,
                visible: false
            },
            {
                field: 'nodeCode',
                title: '节点编号',
                sortable: true
            },
            {
                field: 'deployIp',
                title: 'IP地址'
            },
            {
                field: 'detectionTime',
                title: '更新时间'
            },
            {
                field: 'ntpServerIp',
                title: '校对NTP服务器地址'
            },
            {
                field: 'offsetSeconds',
                title: '偏移值(秒)'
            },
            {
                field: 'status',
                title: '状态',
                align: 'center',
                sortable: true,
                formatter: function (value, row, index) {
                    return $.table.selectDictLabel(ntpdateStatusDatas, value);
                }
            }]
        };
        $.table.init(options);
    }

</script>
</body>
</html>